﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Xml.Linq;
using Microsoft.Phone.Controls.Maps;
using System.Device.Location;

namespace ScannerDemo
{
    public partial class Panorama : PhoneApplicationPage
    {
      
        App App = App.Current as App;
        public Panorama()
        {
            
            InitializeComponent();
            tweetsListBox.ItemsSource = App.GlobalShopList;
            

        }
        /// <summary>
        /// Navigation to MainPage.xaml
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            //Panorama1.DefaultItem = Panorama1.Items[2];
            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            
        }
        /// <summary>
        /// BackKeyPress Implementations
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (MessageBox.Show("Do you really want to exit?", "Page Exit", MessageBoxButton.OKCancel) != MessageBoxResult.OK)
            {
                e.Cancel = true;
            }
            else
            {
                if (NavigationService.CanGoBack)
                {
                    while (NavigationService.RemoveBackEntry() != null)
                    {
                        NavigationService.RemoveBackEntry();
                    }
                }
            }

        }
        /// <summary>
        /// Navigation to Bill.xaml
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/Bill.xaml", UriKind.Relative));
        }
        /// <summary>
        /// Navigation to UserData.xaml
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Detail(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/UserDetail.xaml", UriKind.Relative));
        }


        private void tweetsListBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            if (MessageBox.Show("Do you really want to remove this item ?", "Remove Item ", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                App.GlobalShopList.RemoveAt(tweetsListBox.SelectedIndex);
                tweetsListBox.SizeChanged += new SizeChangedEventHandler(tweetsListBox_SizeChanged);
                tweetsListBox.ItemsSource = App.GlobalShopList;
                NavigationService.Navigate(new Uri("/Temp.xaml", UriKind.RelativeOrAbsolute));
                
            }
            
            
        }

        void tweetsListBox_SizeChanged(object sender, SizeChangedEventArgs e)
        {

            
        }











    }
}